<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript" charset="utf-8">
$(function(){
	$.extend($.fn.validatebox.defaults.rules, {
		floatOrInt: {// 验证是否为小数或整数
			validator: function (value) {
			     return /^(\d{1,3}(,\d\d\d)*(\.\d{1,3}(,\d\d\d)*)?|\d+(\.\d+))?$/i.test(value);
			   },
			     message: '请输入数字，并保证格式正确'
		 },
	});
	 combotree=function(){
		 $('#type').combotree({
			    url : '${pageContext.request.contextPath}/goodTypesAction!tree.action',
			    lines : true,
			    required : true,
			    panelHeight : 'auto',
			    editable : false,
			    onBeforeSelect: function(node) {
		            if (!$(this).tree('isLeaf', node.target)) {
		                return false;
		            }
		        },
		        onClick: function(node) {
		            if (!$(this).tree('isLeaf', node.target)) {
		                $('#ct').combo('showPanel');
		            }
		        }
			});
     };
});
</script>
<div style="padding: 15px;overflow: hidden;">
	<form id="goodForm" method="post">
	<input name="id" type="hidden" />
		<table class="tableForm">
			<tr>
				<th >商品条形码编码</th>
				<td><input name="code" class="easyui-validatebox" data-options="required:true,missingMessage:'请填写商品条形码编码'" />
				</td>
				<th >商品名称</th>
				<td><input name="name" class="easyui-validatebox" data-options="required:true" style="width: 160px;" />
				</td>
				<th>商品类型</th>
				<td><input name="typeid"  id="type" onClick="combotree()"/></td>
			</tr>
			<tr>
				<th>单位</th>
				<td><input name="unit" class="easyui-combobox"  data-options="panelHeight:'auto',required:true,editable:false,valueField: 'label',textField: 'value',data: [{label: '组',value: '组'},{label: '件',value: '件'},{label: '箱',value: '箱'},{label: '盒',value: '盒'},{label: '包',value: '包'},{label: '个',value: '个'},{label: '袋',value: '袋'},{label: '瓶',value: '瓶'},{label: '其他',value: '其他'}]" />
				</td>
				<th>价格</th>
				<td><input name="price" class="easyui-validatebox" data-options="required:true,validType:'floatOrInt'" style="width: 160px;"/>
				</td>
				<th>商品信息</th>
				<td><textarea rows="4" cols="16" name="info"  class="easyui-validatebox" data-options=""></textarea>
				</td>
			</tr>
		</table>
	</form>
</div>
